package com.ktjiaoyu.server.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ktjiaoyu.server.pojo.Admin;
import com.ktjiaoyu.server.pojo.Role;
import com.ktjiaoyu.server.vo.RespBean;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author jjx
 * @since 2024-07-10
 */
public interface IAdminService extends IService<Admin> {

    RespBean login(String username, String password, String code, HttpServletRequest request);

    /**
     * 根据用户名查询用户信息
     * @param userName
     * @return
     */
    public Admin getAdminByUserName(String userName);

    /**
     * 分页查询用户信息
     * @param page
     * @param query
     * @param sort
     * @return
     */
    public IPage<Admin> selectByPage(Page<Admin> page, String query, String sort);

    /**
     * 保存
     * @param admin
     * @return
     */
    public boolean saveAdmin(Admin admin);

    /**
     * 修改
     * @param admin
     * @return
     */
    public boolean updateAdmin(Admin admin);

    /**
     * 根据用户id查询所拥有的角色列表
     * @param id
     * @return
     */
    public List<Role> findRolesByAdminId(Integer id);
}
